package com.hotel.comm.bean;

import org.apache.commons.lang.StringUtils;
import org.apache.lucene.search.SortField;

import java.util.ArrayList;
import java.util.List;

public class EnumConstants {
    /**
     * 是否禁止
     *
     * @author 徐伟君
     * @date 2015-4-19
     */
    public enum IsForbidden {
        FORBIDDEN("禁止"),
        NOFORBIDDEN("非禁止");

        private String msg;

        private IsForbidden(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 用户状态
     *
     * @author 徐伟君
     * @date 2014-2015-4-19
     */
    public enum UserStatus {
        WAITANDSEE("观望状态,看是否有好的机会"),
        HASJOB("已经有工作，不想被打扰"),
        CANCELED("销户");

        private String msg;

        private UserStatus(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 索引文件类型
     *
     * @author xusemon
     * @date 2015-3-16
     */
    public enum IndexType {
        INDEX_POSITION("职位信息索引"),
        INDEX_PERSON("个人信息索引");

        private String msg;

        private IndexType(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 索引文件类型
     *
     * @author xusemon
     * @date 2015-3-16
     */
    public enum ActionType {
        SAVE("保存索引"),
        UPDATE("更新索引"),
        DELETE("删除索引");

        private String msg;

        private ActionType(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 上下线
     *
     * @author xusemon
     * @date 2015-3-16
     */
    public enum IsOnline {
        ONLINE("上线"),
        OFFLINE("下线");

        private String msg;

        private IsOnline(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static IsOnline getByName(String name) {
            for (IsOnline isOnline : IsOnline.values()) {
                if (StringUtils.equalsIgnoreCase(isOnline.name(), name)) {
                    return isOnline;
                }
            }
            return IsOnline.ONLINE;
        }
    }

    /**
     * 是否验证
     *
     * @author xusemon
     * @date 2015-4-29
     */
    public enum IsVerify {
        YES("验证"),
        NO("非验证");

        private String msg;

        private IsVerify(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 是否置顶
     *
     * @author xusemon
     * @date 2015-4-22
     */
    public enum IsTop {
        TOP("置顶"),
        NONTOP("非置顶");

        private String msg;

        private IsTop(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static IsTop getByName(String name) {
            for (IsTop isTop : IsTop.values()) {
                if (StringUtils.equalsIgnoreCase(isTop.name(), name)) {
                    return isTop;
                }
            }
            return IsTop.TOP;
        }
    }

    /**
     * 排序顺序
     *
     * @author xusemon
     * @date 2015-4-26
     */
    public enum Reverse {
        ASC("升序"),
        DESC("降序");

        private String msg;

        private Reverse(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public boolean isDesc() {
            return this.name().equals(DESC.name());
        }
    }

    /**
     * 排序类型
     *
     * @author xusemon
     * @date 2015-4-26
     */
    public enum SortType {
        STRING(String.class, SortField.Type.STRING),
        INT(Integer.class, SortField.Type.INT),
        FLOAT(Float.class, SortField.Type.FLOAT),
        DOUBLE(Double.class, SortField.Type.DOUBLE),
        LONG(Long.class, SortField.Type.LONG);

        @SuppressWarnings("rawtypes")
        private Class clazz;
        private SortField.Type type;

        @SuppressWarnings("rawtypes")
        private SortType(Class clazz, SortField.Type type) {
            this.clazz = clazz;
            this.type = type;
        }

        @SuppressWarnings("rawtypes")
        public Class getClazz() {
            return clazz;
        }

        @SuppressWarnings("rawtypes")
        public void setClazz(Class clazz) {
            this.clazz = clazz;
        }

        public SortField.Type getType() {
            return type;
        }

        public void setType(SortField.Type type) {
            this.type = type;
        }

        @SuppressWarnings("rawtypes")
        public static SortField.Type getType(Class clazz) {
            for (SortType sortType : SortType.values()) {
                if (StringUtils.equalsIgnoreCase(sortType.getClazz().getName(), clazz.getName())) {
                    return sortType.getType();
                }
            }
            return SortType.STRING.getType();
        }
    }

    /**
     * 公司性质
     *
     * @author xusemon
     * @date 2015-4-29
     */
    public enum CompanyNature {
        WAIZIOUMEI("外资(欧美)"),
        WAIZIFEIOUMEI("外资(非欧美)"),
        HEZI("合资"),
        GUOQI("国企"),
        MINYINGQIYE("民营企业"),
        GUONEISHANGSHIGONGSI("国内上市公司"),
        WAIQIDAIBIAOCHU("外企代表处"),
        FEIYINGLIJIGOU("非营利机构"),
        SHIYEDANWEI("事业单位"),
        QITAXINGZHI("其它性质");

        private String msg;

        private CompanyNature(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static CompanyNature getByName(String nature) {
            for (CompanyNature companyNature : CompanyNature.values()) {
                if (StringUtils.equalsIgnoreCase(companyNature.name(), nature)) {
                    return companyNature;
                }
            }
            return CompanyNature.WAIZIOUMEI;
        }

        public static EnumDisplayBean getEnums() {
            List<EnumBean> result = null;
            for (CompanyNature companyNature : CompanyNature.values()) {
                EnumBean enumBean = new EnumBean("companyNature", companyNature.name(), companyNature.getMsg());
                if (result == null) {
                    result = new ArrayList<EnumBean>();
                    result.add(new EnumBean("companyNature", "ALL", "不限"));
                }
                result.add(enumBean);
            }
            return new EnumDisplayBean("公司性质", result);
        }
    }

    /**
     * 工作年限
     *
     * @author xusemon
     * @date 2015-4-22
     */
    public enum WorkingLife {
        GRADUATE(0, "应届毕业生"),
        ONEABOVE(1, "一年以上"),
        TWOABOVE(2, "两年以上"),
        THREEABOVE(3, "三年以上"),
        FIVEABOVE(5, "五年以上"),
        EIGHTABOVE(8, "八年以上"),
        TENABOVE(10, "十年以上");

        private int years;
        private String msg;

        private WorkingLife(int years, String msg) {
            this.years = years;
            this.msg = msg;
        }

        public int getYears() {
            return years;
        }

        public void setYears(int years) {
            this.years = years;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static WorkingLife getByName(String name) {
            for (WorkingLife workingLife : WorkingLife.values()) {
                if (StringUtils.equalsIgnoreCase(workingLife.name(), name)) {
                    return workingLife;
                }
            }
            return WorkingLife.ONEABOVE;
        }

        public static EnumDisplayBean getEnums() {
            List<EnumBean> result = null;
            for (WorkingLife workingLife : WorkingLife.values()) {
                EnumBean enumBean = new EnumBean("workingLife", workingLife.name(), workingLife.getMsg());
                if (result == null) {
                    result = new ArrayList<EnumBean>();
                    result.add(new EnumBean("workingLife", "ALL", "不限"));
                }
                result.add(enumBean);
            }
            return new EnumDisplayBean("工作年限", result);
        }
    }

    /**
     * 职位类型
     *
     * @author xusemon
     * @date 2015-4-28
     */
    public enum PositionType {
        FULLTIME("全职"),
        PARTTIME("兼职");

        private String msg;

        private PositionType(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static PositionType getByName(String type) {
            for (PositionType positionType : PositionType.values()) {
                if (StringUtils.equalsIgnoreCase(positionType.name(), type)) {
                    return positionType;
                }
            }
            return PositionType.FULLTIME;
        }

        public static EnumDisplayBean getEnums() {
            List<EnumBean> result = null;
            for (PositionType positionType : PositionType.values()) {
                EnumBean enumBean = new EnumBean("positionType", positionType.name(), positionType.getMsg());
                if (result == null) {
                    result = new ArrayList<EnumBean>();
                    result.add(new EnumBean("positionType", "ALL", "不限"));
                }
                result.add(enumBean);
            }
            return new EnumDisplayBean("职位类型", result);
        }
    }

    /**
     * 薪资范围
     *
     * @author xusemon
     * @date 2015-5-23
     */
    public enum SalaryRange {
        SALARY_0(0, 2000, "2000以下"),
        SALARY_2000(2001, 5000, "2001-5000"),
        SALARY_5000(5001, 8000, "5001-8000"),
        SALARY_8000(8001, 10000, "8001-10000"),
        SALARY_10000(10001, 15000, "10001-15000"),
        SALARY_15000(15001, 20000, "15001-20000"),
        SALARY_20000(20001, 99999999, "20001以上");

        private int salaryLow;
        private int salaryHight;
        private String msg;

        private SalaryRange(int salaryLow, int salaryHight, String msg) {
            this.salaryLow = salaryLow;
            this.salaryHight = salaryHight;
            this.msg = msg;
        }

        public int getSalaryLow() {
            return salaryLow;
        }

        public void setSalaryLow(int salaryLow) {
            this.salaryLow = salaryLow;
        }

        public int getSalaryHight() {
            return salaryHight;
        }

        public void setSalaryHight(int salaryHight) {
            this.salaryHight = salaryHight;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static SalaryRange getByName(String range) {
            for (SalaryRange salaryRange : SalaryRange.values()) {
                if (StringUtils.equalsIgnoreCase(salaryRange.name(), range)) {
                    return salaryRange;
                }
            }
            return SalaryRange.SALARY_0;
        }

        public static EnumDisplayBean getEnums() {
            List<EnumBean> result = null;
            for (SalaryRange salaryRange : SalaryRange.values()) {
                EnumBean enumBean = new EnumBean("salaryRange", salaryRange.name(), salaryRange.getMsg());
                if (result == null) {
                    result = new ArrayList<EnumBean>();
                    result.add(new EnumBean("salaryRange", "ALL", "不限"));
                }
                result.add(enumBean);
            }
            return new EnumDisplayBean("薪资范围", result);
        }
    }

    /**
     * 公司得分
     *
     * @author xusemon
     * @date 2015-7-5
     */
    public enum CompanyScore {
        SCORE_0(0, 59, "0-60"),
        SCORE_60(60, 100, "60以上"),
        SCORE_70(70, 100, "70以上"),
        SCORE_80(80, 100, "80以上"),
        SCORE_90(90, 100, "90以上");

        private int scoreLow;
        private int scoreHight;
        private String msg;

        private CompanyScore(int scoreLow, int scoreHight, String msg) {
            this.scoreLow = scoreLow;
            this.scoreHight = scoreHight;
            this.msg = msg;
        }

        public int getScoreLow() {
            return scoreLow;
        }

        public void setScoreLow(int scoreLow) {
            this.scoreLow = scoreLow;
        }

        public int getScoreHight() {
            return scoreHight;
        }

        public void setScoreHight(int scoreHight) {
            this.scoreHight = scoreHight;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static CompanyScore getByName(String range) {
            for (CompanyScore companyScore : CompanyScore.values()) {
                if (StringUtils.equalsIgnoreCase(companyScore.name(), range)) {
                    return companyScore;
                }
            }
            return CompanyScore.SCORE_60;
        }

        public static EnumDisplayBean getEnums() {
            List<EnumBean> result = null;
            for (CompanyScore companyScore : CompanyScore.values()) {
                EnumBean enumBean = new EnumBean("companyScore", companyScore.name(), companyScore.getMsg());
                if (result == null) {
                    result = new ArrayList<EnumBean>();
                    result.add(new EnumBean("companyScore", "ALL", "不限"));
                }
                result.add(enumBean);
            }
            return new EnumDisplayBean("公司得分", result);
        }
    }

    /**
     * 学历要求
     *
     * @author xusemon
     * @date 2015-5-23
     */
    public enum EducationRequirements {
        CHUZHONG("初中"),
        GAOZHONG("高中"),
        ZHONGJI("中技"),
        ZHONGZHUAN("中专"),
        DAZHUAN("大专"),
        BENKE("本科"),
        SHUOSHI("硕士"),
        EMBA("MBA/EMBA"),
        BOSHI("博士"),
        BOSHIHOU("博士后"),
        OTHER("其他");

        private String msg;

        private EducationRequirements(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static EducationRequirements getByName(String requirements) {
            for (EducationRequirements educationRequirements : EducationRequirements.values()) {
                if (StringUtils.equalsIgnoreCase(educationRequirements.name(), requirements)) {
                    return educationRequirements;
                }
            }
            return EducationRequirements.BENKE;
        }

        public static EnumDisplayBean getEnums() {
            List<EnumBean> result = null;
            for (EducationRequirements educationRequirements : EducationRequirements.values()) {
                EnumBean enumBean = new EnumBean("educationRequirements", educationRequirements.name(), educationRequirements.getMsg());
                if (result == null) {
                    result = new ArrayList<EnumBean>();
                    result.add(new EnumBean("educationRequirements", "ALL", "不限"));
                }
                result.add(enumBean);
            }
            return new EnumDisplayBean("学历要求", result);
        }
    }

    /**
     * 公司规模
     *
     * @author xusemon
     * @date 2015-5-23
     */
    public enum CompanySize {
        SIZE_0("少于50人"),
        SIZE_50("50-150人"),
        SIZE_150("150-500人"),
        SIZE_500("500-1000人"),
        SIZE_1000("1000-5000人"),
        SIZE_5000("5000-10000人"),
        SIZE_10000("10000人以上");

        private String msg;

        private CompanySize(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static CompanySize getByName(String size) {
            for (CompanySize companySize : CompanySize.values()) {
                if (StringUtils.equalsIgnoreCase(companySize.name(), size)) {
                    return companySize;
                }
            }
            return CompanySize.SIZE_0;
        }

        public static EnumDisplayBean getEnums() {
            List<EnumBean> result = null;
            for (CompanySize companySize : CompanySize.values()) {
                EnumBean enumBean = new EnumBean("companySize", companySize.name(), companySize.getMsg());
                if (result == null) {
                    result = new ArrayList<EnumBean>();
                    result.add(new EnumBean("companySize", "ALL", "不限"));
                }
                result.add(enumBean);
            }
            return new EnumDisplayBean("公司规模", result);
        }
    }

    /**
     * 金币获取途径
     *
     * @author xusemon
     * @date 2015-5-23
     */
    public enum GainGoldWay {
        REGIST("注册"),
        PURCHASE("购买"),
        FILLIN("填写简历"),
        COMMENT("评论");

        private String msg;

        private GainGoldWay(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static GainGoldWay getByName(String size) {
            for (GainGoldWay gainGoldWay : GainGoldWay.values()) {
                if (StringUtils.equalsIgnoreCase(gainGoldWay.name(), size)) {
                    return gainGoldWay;
                }
            }
            return GainGoldWay.COMMENT;
        }
    }

    /**
     * 是否过期
     *
     * @author frank
     */
    public enum IsExpired {
        EXPIRED("过期"),
        NOEXPIRED("未过期");

        private String msg;

        private IsExpired(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 性别要求
     *
     * @author frank
     */
    public enum SexRequired {
        MALE("男"),
        FEMALE("女"),
        NOREQUIRED("不限");

        private String msg;

        private SexRequired(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 语言要求
     *
     * @author frank
     */
    public enum LanguageRequired {
        CHINESE("普通话"),
        ENGLISH("英文"),
        JAPANESE("日文"),
        NOREQUIRED("不限");

        private String msg;

        private LanguageRequired(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 找工作状态
     *
     * @author frank
     */
    public enum FindJobStatus {
        LOOK_JOB("在职，看看新机会"),
        URGEN_JOB("在职，急需新工作"),
        NO_PLAN_JOB("在职，暂无跳槽打算"),
        LOOKING_JOB("离职，正在找工作");

        private String msg;

        private FindJobStatus(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

}
